<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/business/buyer/template.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="tradeId" value="#{tradeHome.id}" required="true"></f:viewParam>
	   	<f:event listener="#{tradeHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:event listener="#{tradeRatingHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:event listener="#{tradeRatingHome.validateTrade()}" type="preRenderView"></f:event>
   	</f:metadata>
   	<ui:define name="buyer_head">
   		<style type="text/css">
			.column1 {
				width: 20%
			}
			
			.column2 {
				width: 80%
			}
		</style>
   	
   	</ui:define>
	<ui:define name="buyer_content">

		<h:form id="editForm">
			<p:panel
				id="panel"
				header="评价"
				style="margin-bottom:10px;">
				<p:messages
					id="messages"
					closable="true">
					<p:autoUpdate />
				</p:messages>
				<h:panelGrid
					columns="2"
					cellpadding="5"
					columnClasses="column1,column2">
					<p:outputLabel value="公告标题" />
					<h:outputText
						id="bulletinTitle"
						value="#{tradeHome.instance.bulletin.title}" />
					<p:outputLabel value="中选中介机构" />
					<h:outputText
						id="supplierName"
						value="#{tradeHome.instance.supplier.cnname}" />


					<p:outputLabel value="评分" for="score" style="padding-bottom: 5px;"/>
					<p:outputLabel >
						<h:outputText id="output" value="当前评分为：#{tradeRatingHome.instance.score}分" />
						<h:inputHidden  id="score" required="true" value="#{tradeRatingHome.instance.score}" />
						<p:slider for="score"
								  display="output"
								  displayTemplate="当前评分为： {value}分"
								  minValue="#{tradeRatingHome.minScore}"
								  maxValue="#{tradeRatingHome.maxScore}"
								  step="1" style="width: 400px;margin-top:10px;color: red"
						/>
					</p:outputLabel>

					<p:outputLabel
						for="quality"
						value="服务质量评价" />
					<p:inputTextarea
						id="quality"
						value="#{tradeRatingHome.instance.quality}"
						required="true"
						cols="50"
						rows="3"></p:inputTextarea>

					<p:outputLabel
						for="effectiveness"
						value="服务时效评价" />
					<p:inputTextarea
						id="effectiveness"
						value="#{tradeRatingHome.instance.effectiveness}"
						required="true"
						cols="50"
						rows="3"></p:inputTextarea>

					<p:outputLabel
						for="attitude"
						value="服务态度评价" />
					<p:inputTextarea
						id="attitude"
						value="#{tradeRatingHome.instance.attitude}"
						required="true"
						cols="50"
						rows="3"></p:inputTextarea>

					<p:outputLabel
						for="charge"
						value="服务收费评价" />
					<p:inputTextarea
						id="charge"
						value="#{tradeRatingHome.instance.charge}"
						required="true"
						cols="50"
						rows="3"></p:inputTextarea>

					<p:outputLabel
						for="standard"
						value="服务规范评价" />
					<p:inputTextarea
						id="standard"
						value="#{tradeRatingHome.instance.standard}"
						required="true"
						cols="50"
						rows="3"></p:inputTextarea>

				</h:panelGrid>

			</p:panel>

			<p:commandButton
				value="发布评价"
				action="#{tradeRatingHome.saveAndFlush()}" />
			<p:commandButton
				action="#{tradeRatingHome.cancel()}"
				value="取消"
				immediate="true"></p:commandButton>
		</h:form>

		<p:dialog
			id="warnDialog"
			widgetVar="warnDialog"
			width="640"
			height="480"
			modal="true">
			<h:form>
				<p:panel>
					<f:facet name="header">评价须知</f:facet>

					<h:outputText value="请慎重评价" />
					<f:facet name="footer">
						<p:commandButton
							value="确定发布"
							action="#{tradeRatingHome.saveAndFlush()}" />
						<p:commandButton
							value="取消"
							onclick="PF('warnDialog').hide();" />
					</f:facet>
				</p:panel>
			</h:form>
		</p:dialog>
	</ui:define>
</ui:composition>
